﻿using System;
using System.Buffers;
using System.Collections.Generic;
using System.Text;

namespace JESAI.Core.Websocket.Client.Messages
{
    internal abstract class RequestMessage { }

    /// <summary>
    /// 带有文本有效负载的请求消息。
    /// </summary>
    internal class RequestTextMessage : RequestMessage
    {
        public string Text { get; }

        public RequestTextMessage(string text)
        {
            Text = text;
        }
    }

    /// <summary>
    /// 带有二进制有效负载的请求消息。
    /// </summary>
    internal class RequestBinaryMessage : RequestMessage
    {
        public byte[] Data { get; }

        public RequestBinaryMessage(byte[] data)
        {
            Data = data;
        }
    }

    /// <summary>
    /// 带有二进制段有效负载的请求消息。
    /// </summary>
    internal class RequestBinarySegmentMessage : RequestMessage
    {
        public ArraySegment<byte> Data { get; }

        public RequestBinarySegmentMessage(ArraySegment<byte> data)
        {
            Data = data;
        }
    }

    /// <summary>
    /// 带有二进制序列有效负载的请求消息。
    /// </summary>
    internal class RequestBinarySequenceMessage : RequestMessage
    {
        public ReadOnlySequence<byte> Data { get; }

        public RequestBinarySequenceMessage(ReadOnlySequence<byte> data)
        {
            Data = data;
        }
    }
}
